'\" te
.\"  Copyright (c) 2006, Sun Microsystems, Inc.,  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SCSI_SYNC_PKT 9F "Jan 16, 2006"
.SH NAME
scsi_sync_pkt \- synchronize CPU and I/O views of memory
.SH SYNOPSIS
.nf
#include <sys/scsi/scsi.h>



\fBvoid\fR \fBscsi_sync_pkt\fR(\fBstruct scsi_pkt *\fR\fIpktp\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI).
.SH PARAMETERS
.ne 2
.na
\fB\fIpktp\fR\fR
.ad
.RS 8n
Pointer to a \fBscsi_pkt\fR(9S) structure.
.RE

.SH DESCRIPTION
The \fBscsi_sync_pkt()\fR function is used to selectively synchronize a
\fBCPU\fR's or device's view of the data associated with the \fBSCSI\fR packet
that has been mapped for \fBI/O\fR. This may involve operations such as flushes
of \fBCPU\fR or \fBI/O\fR caches, as well as other more complex operations such
as stalling until hardware write buffers have drained.
.sp
.LP
This function need only be called under certain circumstances. When a
\fBSCSI\fR packet is mapped for \fBI/O\fR using \fBscsi_init_pkt\fR(9F) and
destroyed using \fBscsi_destroy_pkt\fR(9F), then an implicit
\fBscsi_sync_pkt()\fR will be performed. However, if the memory object has been
modified by either the device or a \fBCPU\fR after the mapping by
\fBscsi_init_pkt\fR(9F), then a call to \fBscsi_sync_pkt()\fR is required.
.sp
.LP
If the same scsi_pkt is reused for a data transfer from memory to a device,
then \fBscsi_sync_pkt()\fR must be called before calling
\fBscsi_transport\fR(9F). If the same packet is reused for a data transfer from
a device to memory \fBscsi_sync_pkt()\fR must be called after the completion of
the packet but before accessing the data in memory.
.SH CONTEXT
The \fBscsi_sync_pkt()\fR function may be called from user, interrupt, or
kernel context.
.SH SEE ALSO
.BR tran_sync_pkt (9E),
.BR ddi_dma_sync (9F),
.BR scsi_destroy_pkt (9F),
.BR scsi_init_pkt (9F),
.BR scsi_transport (9F),
.BR scsi_pkt (9S)
.sp
.LP
\fIWriting Device Drivers\fR
